using Proto;

namespace sgf.server
{
    public interface IOnStop;

    public interface IOnStopSystem : ISystemType
    {
        Task Run(IBusActor busActor, IContext context);
    }

    public abstract class OnStopSystem<T> : IOnStopSystem where T : IOnStop
    {
        public async Task Run(IBusActor busActor, IContext context)
        {
            await this.OnStop((T)busActor, context);
        }

        public abstract Task OnStop(T busActor, IContext context);

        public Type Type()
        {
            return typeof(T);
        }
    }
}